#include "tcpServer.hpp"
#include "daemon.hpp"

#include <memory>

void Usage(char *proc)
{
    std::cout << "\nUsage\n\t" << proc << "loacl_port\n\n";
}

// ./tcpserver 8080
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }

    uint16_t port = atoi(argv[1]);
    std::unique_ptr<tcpServer> tsvr(new tcpServer(port));
    tsvr->initServer();

    deamonSelf();
    tsvr->start();

    return 0;
}